package cn.rongdao.jrkabao.ui.remind.adapter;

import android.view.View;

import com.mifengkong.frtools.ui.adapter.recyclerview.FRBaseRecyclerViewHolder;

import cn.rongdao.jrkabao.bean.remind.RemindBean;
import cn.rongdao.jrkabao.ui.remind.uicomponent.ItemRemindUIComponent;

/**
 * Created by jack on 2017/9/11
 */

public class RemindViewHolder extends FRBaseRecyclerViewHolder<RemindBean.RemindBankList> {

    private ItemRemindUIComponent itemRemindUIComponent;

    public RemindViewHolder(View view, final OnRemindItemClickListener onRemindItemClickListener) {
        super(view);
        itemRemindUIComponent = (ItemRemindUIComponent) view;

        itemRemindUIComponent.setCheckBalanceClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null!=onRemindItemClickListener){
                    onRemindItemClickListener.checkBalance(getLayoutPosition());
                }
            }
        });

        itemRemindUIComponent.setRepaymentClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null!=onRemindItemClickListener){
                    onRemindItemClickListener.repayment(getLayoutPosition());
                }
            }
        });
    }

    @Override
    protected void onItemDataUpdated(RemindBean.RemindBankList remindBean) {
        itemRemindUIComponent.setContent(remindBean);
    }

    public interface OnRemindItemClickListener {
        void checkBalance(int position);

        void repayment(int position);
    }
}
